package SQL;

use strict;
use warnings;
use Carp qw(croak);
use DBI;

use vars qw(@ISA @EXPORT $version);
$version = 1.0;
@ISA     = ('Exporter');
@EXPORT  = qw(&connect);

#-------------------------------------------------
# $name   return SQL handle
# @param  database name
# @return SQL handle
#-------------------------------------------------
sub connect{
	my ($dbName) = @_;
	### connect to databases
	my $dsn = "DBI:mysql:$dbName";
	my $dbh = DBI->connect($dsn, "hideki", "odyssey", {
	PrintError => 0,
	RaiseError => 1
	}) or die ("fail to connect databases\n");
	return $dbh;	
}